<script type="text/javascript">
	jQuery(document).ready(function(){
    	jQuery("#form1").validationEngine();
   });
</script>
<form id="form1" name="form1" method="post" action="<?php echo $do_addedit_link;?>" enctype="multipart/form-data">
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td align="left" class="block-block"><?php echo $action?> Email Template</td>
    </tr>
    <tr>
      <td class="border_add"><table width="100%" border="0" align="left" cellpadding="4" cellspacing="4">          
          <tr>
            <td width="11%" align="right" valign="middle" nowrap="nowrap"><font color="#FF0000">*</font>Template Name</td>
            <td width="2%" align="center" valign="middle">:</td>
            <td colspan="2"><input name="template_name" type="text" id="template_name" class="validate[required] textbox" value="<?php echo $template_name?>" style="width:450px;" />
            &nbsp;&nbsp;<font color="#FF0000"><?php echo form_error('template_name'); ?></font></td>
          </tr>
		  <tr>
            <td align="right" valign="middle" nowrap="nowrap"><font color="#FF0000">*</font>From Name</td>
            <td align="center" valign="middle">:</td>
            <td colspan="2"><input name="from_name" type="text" id="from_name" class="validate[required] textbox" value="<?php echo $from_name?>" style="width:450px;" />
              &nbsp;&nbsp;<font color="#FF0000"><?php echo form_error('from_name'); ?></font></td>
          </tr>
		  <tr>
            <td align="right" valign="middle" nowrap="nowrap"><font color="#FF0000">*</font>From Email</td>
            <td align="center" valign="middle">:</td>
            <td colspan="2"><input name="from_email" type="text" id="from_email" class="validate[required,custom[email]] textbox" value="<?php echo $from_email?>" style="width:450px;" />
              &nbsp;&nbsp;<font color="#FF0000"><?php echo form_error('from_email'); ?></font></td>
          </tr>
		  <tr>
            <td align="right" valign="middle" nowrap="nowrap"><font color="#FF0000">*</font>Template Code</td>
            <td align="center" valign="middle">:</td>
            <td colspan="2">
             <?php if($action == 'Add') { ?>
            <input name="template_code" type="text" id="template_code" class="validate[required] textbox" value="<?php echo $template_code?>" style="width:450px;" />
					<?php } 
						else {
							?>
							<input name="template_code" type="text" id="template_code" class="validate[required] textbox" readonly="readonly"  value="<?php echo $template_code?>" style="width:450px;" />(Non Editable)
							<?php
							}					
					?>             
              &nbsp;&nbsp;<font color="#FF0000"><?php echo form_error('template_code'); ?></font></td>
          </tr>
		  <tr>
            <td align="right" valign="middle" nowrap="nowrap"><font color="#FF0000">*</font>Subject</td>
            <td align="center" valign="middle">:</td>
            <td colspan="2"><input name="subject" type="text" id="subject" class="validate[required] textbox" value="<?php echo $subject?>" style="width:450px;" />
              &nbsp;&nbsp;<font color="#FF0000"><?php echo form_error('subject'); ?></font></td>
          </tr>
          <tr>
            <td align="right" valign="top" nowrap="nowrap">Email Body</td>
            <td align="center" valign="top">:</td>
            <td width="12%" valign="top"><?php echo $this->fckeditor->Create('email_body',$email_body) ; ?></td>
            <td width="75%" valign="top"><!--<?php //if(count($available_vairables)>0){ ?><strong>Available Variables</strong> <br/><?php //echo str_replace("var ","",implode("<br/>",$available_vairables[1]));}?>--></td>
          </tr>
          <tr>
            <td align="right" valign="middle">&nbsp;</td>
            <td align="center" valign="middle">&nbsp;</td>
            <td colspan="2"><input type="submit" name="Submit" value=" Submit " onmouseover="this.className='normal-bttn1'" onmouseout="this.className='normal-bttn'" class="normal-bttn" />
              &nbsp;&nbsp;
              <input name="Submit2" type="button" value="Cancel" onmouseover="this.className='normal-bttn1'" onmouseout="this.className='normal-bttn'" class="normal-bttn" onclick="location.href='<?php echo $back_link?>'"></td>
          </tr>
          <tr>
            <td align="right" valign="middle">&nbsp;</td>
            <td align="center" valign="middle">&nbsp;</td>
            <td colspan="2">&nbsp;</td>
          </tr>
        </table></td>
    </tr>
  </table>
</form>
